import React, { Component } from 'react'
import Child from '../Child/Child'
export default class Father extends Component {
    state = { hasError: '' }
    static getDerivedStateFromError(err) {
        return { hasError: err }
    }
    render() {
        return (
            <div>
                <h1>父组件</h1>
                {this.state.hasError ? <h2> 当前网络错误,请稍后 </h2> : <Child />}
            </div>
        )
    }
}
